home *** CD-ROM | disk | FTP | other *** search
- Path: news.sni.de!news
- From: Josef Moellers <mollers.pad@sni.de>
- Newsgroups: comp.lang.c
- Subject: Re: Calling a Function Twice from a printf statement.
- Date: 4 Mar 1996 09:33:48 GMT
- Organization: Siemens Nixdorf Informationssysteme AG, Paderborn, Germany
- Message-ID: <4hedds$bbt@nervous.pdb.sni.de>
- References: <4he6q9$6r6@newsbf02.news.aol.com>
- NNTP-Posting-Host: uranium.pdb.sni.de
- X-Newsreader: NN version 6.5.0 #2
-
- In <4he6q9$6r6@newsbf02.news.aol.com> razine@aol.com (Razine) writes:
-
- >int num(int index) {
- > int return_number;
- >
- > switch(index) {
- > case 0 : return_number=0;
- > case 1 : return_number=1;
- > }
- > return(return_number);
- >}
-
- My compiler says "[warning]: Flow between cases"!
-
- And the program prints
- First Number is 1 , the Second s 1
- which is consistent with the error message.
-
- You need to put "break;" statements after each of the cases in the
- switch:
-
- switch(index) {
- case 0 : return_number=0; break;
- case 1 : return_number=1; break;
- }
-
- Happy switching,
-
- Josef
- --
- Josef Moellers work: mollers.pad@sni.de
- home: josef@firefox.pb.owl.de
-